package c.c.a;

import android.app.Application;

public class o1 extends q1 {
    public long d;
    public final g2 e;
    public final c f;

    public o1(Application application, c cVar, g2 g2Var) {
        super(application);
        this.f = cVar;
        this.e = g2Var;
    }

    public boolean a() {
        return true;
    }

    public long b() {
        long j = this.e.e.getLong("abtest_fetch_interval", 0);
        if (j < 600000) {
            j = 600000;
        }
        return this.d + j;
    }

    public long[] c() {
        return w1.g;
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x0086  */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x007f  */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0089  */
    /* JADX WARNING: Removed duplicated region for block: B:11:0x006a  */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x007f  */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x0086  */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0089  */
    public boolean d() {
        /*
        r11 = this;
        r0 = r11.f;
        r0 = r0.a();
        r1 = r11.f;
        r1 = r1.j();
        r2 = 0;
        if (r1 == 0) goto L_0x0179;
    L_0x000f:
        if (r0 == 0) goto L_0x0179;
    L_0x0011:
        r0 = java.lang.System.currentTimeMillis();
        r3 = new org.json.JSONObject;
        r3.<init>();
        r4 = "header";
        r5 = r11.f;
        r5 = r5.a();
        r3.put(r4, r5);
        r4 = "magic_tag";
        r5 = "ss_app_log";
        r3.put(r4, r5);
        r4 = "_gen_time";
        r3.put(r4, r0);
        r4 = r11.a;
        r5 = r11.f;
        r5 = r5.a();
        r6 = c.c.a.q.f;
        r6 = r6.getABConfigUri();
        r7 = com.bytedance.embedapplog.AppLog.getIAppParam();
        r8 = 1;
        r4 = c.c.a.r.a(r4, r5, r6, r8, r7);
        r5 = c.c.a.q.e;
        r4 = c.c.a.q.c(r4, r5);
        r3 = r3.toString();
        r3 = com.bytedance.embedapplog.AppLog.toEncryptByte(r3);
        r5 = 0;
        r3 = c.c.a.q.a(r8, r4, r5, r3);
        if (r3 == 0) goto L_0x0067;
    L_0x005d:
        r4 = new org.json.JSONObject;	 Catch:{ JSONException -> 0x0063 }
        r4.<init>(r3);	 Catch:{ JSONException -> 0x0063 }
        goto L_0x0068;
    L_0x0063:
        r3 = move-exception;
        r3.printStackTrace();
    L_0x0067:
        r4 = r5;
    L_0x0068:
        if (r4 == 0) goto L_0x007c;
    L_0x006a:
        r3 = "message";
        r6 = "";
        r3 = r4.optString(r3, r6);
        r6 = "success";
        r3 = r6.equals(r3);
        if (r3 == 0) goto L_0x007c;
    L_0x007a:
        r3 = 1;
        goto L_0x007d;
    L_0x007c:
        r3 = 0;
    L_0x007d:
        if (r3 == 0) goto L_0x0086;
    L_0x007f:
        r3 = "data";
        r3 = r4.optJSONObject(r3);
        goto L_0x0087;
    L_0x0086:
        r3 = r5;
    L_0x0087:
        if (r3 == 0) goto L_0x0179;
    L_0x0089:
        r4 = com.bytedance.embedapplog.AppLog.getAbConfig();
        r6 = com.bytedance.embedapplog.AppLog.getDataObserver();
        r4 = c.c.a.n0.c(r4, r3);
        r4 = r4 ^ r8;
        r6.onRemoteAbConfigGet(r4, r3);
        r4 = c.c.a.m0.b;
        if (r4 == 0) goto L_0x00b1;
    L_0x009d:
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r6 = "getAbConfig ";
        r4.append(r6);
        r4.append(r3);
        r4 = r4.toString();
        c.c.a.m0.a(r4, r5);
    L_0x00b1:
        r4 = r11.f;
        r6 = r4.c;
        java.util.Objects.requireNonNull(r6);
        r7 = new java.lang.StringBuilder;
        r7.<init>();
        r9 = "setAbConfig, ";
        r7.append(r9);
        r9 = r3.toString();
        r7.append(r9);
        r7 = r7.toString();
        c.c.a.m0.a(r7, r5);
        r7 = r6.c;
        r7 = r7.edit();
        r9 = r3.toString();
        r10 = "ab_configure";
        r7 = r7.putString(r10, r9);
        r7.apply();
        r6.f = r5;
        monitor-enter(r4);
        r5 = r4.d;	 Catch:{ all -> 0x0176 }
        r6 = "ab_version";
        r5 = r5.optString(r6);	 Catch:{ all -> 0x0176 }
        r6 = android.text.TextUtils.isEmpty(r5);	 Catch:{ all -> 0x0176 }
        if (r6 != 0) goto L_0x0172;
    L_0x00f4:
        r6 = ",";
        r5 = r5.split(r6);	 Catch:{ all -> 0x0176 }
        r6 = new java.util.HashSet;	 Catch:{ all -> 0x0176 }
        r6.<init>();	 Catch:{ all -> 0x0176 }
        r7 = r5.length;	 Catch:{ all -> 0x0176 }
    L_0x0100:
        if (r2 >= r7) goto L_0x0110;
    L_0x0102:
        r9 = r5[r2];	 Catch:{ all -> 0x0176 }
        r10 = android.text.TextUtils.isEmpty(r9);	 Catch:{ all -> 0x0176 }
        if (r10 != 0) goto L_0x010d;
    L_0x010a:
        r6.add(r9);	 Catch:{ all -> 0x0176 }
    L_0x010d:
        r2 = r2 + 1;
        goto L_0x0100;
    L_0x0110:
        r2 = r3.keys();	 Catch:{ all -> 0x0176 }
        r5 = new java.util.HashSet;	 Catch:{ all -> 0x0176 }
        r5.<init>();	 Catch:{ all -> 0x0176 }
    L_0x0119:
        r7 = r2.hasNext();	 Catch:{ all -> 0x0176 }
        if (r7 == 0) goto L_0x0142;
    L_0x011f:
        r7 = r2.next();	 Catch:{ all -> 0x0176 }
        r9 = r7 instanceof java.lang.String;	 Catch:{ all -> 0x0176 }
        if (r9 == 0) goto L_0x0119;
    L_0x0127:
        r7 = (java.lang.String) r7;	 Catch:{ all -> 0x0176 }
        r9 = android.text.TextUtils.isEmpty(r7);	 Catch:{ all -> 0x0176 }
        if (r9 != 0) goto L_0x0119;
    L_0x012f:
        r7 = r3.getJSONObject(r7);	 Catch:{ JSONException -> 0x013d }
        r9 = "vid";
        r7 = r7.optString(r9);	 Catch:{ JSONException -> 0x013d }
        r5.add(r7);	 Catch:{ JSONException -> 0x013d }
        goto L_0x0119;
    L_0x013d:
        r7 = move-exception;
        c.c.a.m0.b(r7);	 Catch:{ all -> 0x0176 }
        goto L_0x0119;
    L_0x0142:
        r6.retainAll(r5);	 Catch:{ all -> 0x0176 }
        r2 = "ab_version";
        r3 = new java.lang.StringBuilder;	 Catch:{ all -> 0x0176 }
        r3.<init>();	 Catch:{ all -> 0x0176 }
        r5 = r6.iterator();	 Catch:{ all -> 0x0176 }
    L_0x0150:
        r6 = r5.hasNext();	 Catch:{ all -> 0x0176 }
        if (r6 == 0) goto L_0x016b;
    L_0x0156:
        r6 = r5.next();	 Catch:{ all -> 0x0176 }
        r6 = (java.lang.String) r6;	 Catch:{ all -> 0x0176 }
        r3.append(r6);	 Catch:{ all -> 0x0176 }
        r6 = r5.hasNext();	 Catch:{ all -> 0x0176 }
        if (r6 == 0) goto L_0x0150;
    L_0x0165:
        r6 = ",";
        r3.append(r6);	 Catch:{ all -> 0x0176 }
        goto L_0x0150;
    L_0x016b:
        r3 = r3.toString();	 Catch:{ all -> 0x0176 }
        r4.d(r2, r3);	 Catch:{ all -> 0x0176 }
    L_0x0172:
        monitor-exit(r4);
        r11.d = r0;
        return r8;
    L_0x0176:
        r0 = move-exception;
        monitor-exit(r4);
        throw r0;
    L_0x0179:
        return r2;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.a.o1.d():boolean");
    }

    public String e() {
        return "ab";
    }
}
